/* assert.hh
* This file is part of ncursesxx library
* Copyright (c) 2003,2004 by Stanislav Ievlev
*
* This file is covered by the GNU Library General Public License,
* which should be included with libncursesxx as the file COPYING.
*/
#ifndef NCURSESXX_ASSERT_HH__
#define NCURSESXX_ASSERT_HH__

#include <stdexcept>

namespace ncurses
{

	/**
	 * library runtime exception
	 */
	class runtime_error: public std::runtime_error
	{
	public:
		explicit
		runtime_error(const std::string& descr): std::runtime_error(descr) {};
	};

	/**
	 * generate exception if assert failed
	 * @param expr failed expression
	 * @param file file name where assert failed
	 * @param line line where assert failed
	 */
	void make_ncurses_assert(const std::string &expr, const std::string& file, int line);

	/**
	 * simple assertion for all ncurses like falls (!=OK)
	 */
#define NCURSES_ASSERT(expr) \
if ( (expr) != OK ) ncurses::make_ncurses_assert(#expr, __FILE__, __LINE__)

}

#endif
